import request from '@/utils/request';

// oem查询代理列表：http://localhost/business/oemAgent/page
// oem代理列表查询商家：http://localhost/business/MerchantManagement/oemMerchantId

// oem查询代理列表
export async function oemQueryAgentList(data) {
  const res = await request.post('/business/oemAgent/page', data);
  if (res.data.code === 2000) {
    return res.data;
  }
  // console.log(res)
  // return res
  return Promise.reject(new Error(res));
}

//  oem代理列表查询商家

export async function oemAgentListQueryBusiness(data) {
  const res = await request.post(
    '/business/MerchantManagement/notApplyforMerchant',
    data
  );
  if (res.data.code === 2000) {
    return res.data;
  }
  // console.log(res)
  // return res
  return Promise.reject(new Error(res));
}

/**
 * @param
 */

export async function pageListOem(params) {
  const res = await request.post('/business/wechatpay/pageList', params);
  if (res.data.code === 2000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}
export async function dsfmerenterinfoPage(params) {
  const res = await request.post('/business/dsfmerenterinfo/page', params);
  if (res.data.code === 2000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}
export async function selectByPrimaryKey(data) {
  const res = await request.post(
    '/business/wechatpay/selectByPrimaryKey',
    data
  );
  console.log(res.data);
  if (res.data.code === 2000) {
    return res.data;
  }
  // return res
  return Promise.reject(new Error(res));
}

// 新版都支付查看详情
export async function getMerenterInfo(data) {
  const res = await request.post(
    '/business/dsfmerenterinfo/getMerenterInfo',
    data
  );
  console.log(res.data);
  if (res.data.code === 2000) {
    return res.data;
  }
  // return res
  return Promise.reject(new Error(res));
}
// 新版抖支付进件审核
export async function merApplyFor(data) {
  const res = await request.post('/business/dsfmerenterinfo/merApplyFor', data);
  console.log(res.data);
  if (res.data.code === 2000) {
    return res.data;
  } else {
    return res.data;
  }
  // return res
  return Promise.reject(new Error(res));
}

// 新版都支付 功能变更列表

export async function gnPage(data) {
  const res = await request.post('/business/dsfmerenterinfo/gnPage', data);
  console.log(res.data);
  if (res.data.code === 2000) {
    return res.data;
  }
  // return res
  return Promise.reject(new Error(res));
}

// 新版变更

export async function funcInfoChangeApi(data) {
  const res = await request.post(
    '/business/dsfmerenterinfo/funcInfoChange',
    data
  );
  console.log(res.data);
  if (res.data.code === 2000) {
    return res.data;
  }
  // return res
  return Promise.reject(new Error(res));
}
